package com.woniu.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class InjectResources {
    @Value("${QiNiuYun.accessKey}")
    private String accessKey;
    @Value("${QiNiuYun.secretKey}")
    private String secretKey;
    @Value("${QiNiuYun.url}")
    private String url;
    @Value("${QiNiuYun.bucket}")
    private String bucket;

    @Value("${Aliyun.endpoint}")
    private String endpoint;
    @Value("${Aliyun.accessKeyId}")
    private String accessKeyId;
    @Value("${Aliyun.accessKeySecret}")
    private String accessKeySecret;
    @Value("${Aliyun.bucketName}")
    private String bucketName;



    public static String ACCESSKEY;
    public static String SECRETKEY;
    public static String URL;
    public static String BUCKET;
    public static String ENDPOINT;
    public static String ACCESSKEYID;
    public static String ACCESSKEYSECRET;
    public static String BUCKETNAME;



    /**
     * @PostConstruct 表示对象一初始化, 就将数据注入到静态资源中
     */
    @PostConstruct
    public void init() {
        ACCESSKEY=accessKey;
        SECRETKEY=secretKey;
        URL=url;
        BUCKET=bucket;
        ENDPOINT=endpoint;
        ACCESSKEYID=accessKeyId;
        ACCESSKEYSECRET=accessKeySecret;
        BUCKETNAME=bucketName;
    }


}
